import request from '@/config/axios'

// PI 巡查分类 VO
export interface PatrolCategoryVO {
  id: number // 编号
  name: string // 名字
  parentId: number // 父级编号
  sort: number // 排序
}

// PI 巡查分类 API
export const PatrolCategoryApi = {
  // 查询PI 巡查分类列表
  getPatrolCategoryList: async (params) => {
    return await request.get({ url: `/pi/patrol-category/list`, params })
  },

  // 查询PI 巡查分类详情
  getPatrolCategory: async (id: number) => {
    return await request.get({ url: `/pi/patrol-category/get?id=` + id })
  },

  // 新增PI 巡查分类
  createPatrolCategory: async (data: PatrolCategoryVO) => {
    return await request.post({ url: `/pi/patrol-category/create`, data })
  },

  // 修改PI 巡查分类
  updatePatrolCategory: async (data: PatrolCategoryVO) => {
    return await request.put({ url: `/pi/patrol-category/update`, data })
  },

  // 删除PI 巡查分类
  deletePatrolCategory: async (id: number) => {
    return await request.delete({ url: `/pi/patrol-category/delete?id=` + id })
  },

  // 导出PI 巡查分类 Excel
  exportPatrolCategory: async (params) => {
    return await request.download({ url: `/pi/patrol-category/export-excel`, params })
  },
}
